Skip to content

test(orchestrator): run the git provider wiring tests' git through gitexec - #1175

Draft
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/test-orchestrator-config-gitexec
Draft

sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/test-orchestrator-config-gitexec

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

TLDR: The orchestrator git provider wiring tests now run git through gitexec, so they no longer fail on hosts whose git config enables commit signing.

Summary

  • TestNewProfiles_GitChangeProviderReadsARealRepository failed on every run on hosts with system commit.gpgsign=true (git commit exited 128) because its run closure used exec.Command with the inherited environment.
  • Both run closures in service/submitqueue/orchestrator/server/config_test.go now use gitexec.Command, which isolates host git config (system and global, removing signing and hooks) and puts the pinned git first on PATH. It does not pin every git helper: local clone and push still run git-upload-pack and git-receive-pack from host git.
  • The Tango test's --no-gpg-sign workaround is dropped; it is no longer needed.
  • Test-only change; adds the //platform/git/exec test dep.

Test Plan

  • Before the change, on a host with system commit.gpgsign=true: ./tool/bazel test //service/submitqueue/orchestrator/server:go_default_test --nocache_test_results failed 1/1 at git [commit -m seed], exit status 128, error: gpg failed to sign the data / fatal: failed to write commit object.
  • After: same command with --runs_per_test=20 --runs_per_test_detects_flakes passed 20/20.
  • After: same target with --@rules_go//go/config:race --build_tests_only --runs_per_test=10 --nocache_test_results passed 10/10.
  • make gazelle, make fmt, make lint, make check-gazelle, make check-tidy all pass.

🤖 Generated with Claude Code

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flaky-1-d3-reviewer] nit: PR body, Test Plan, "Before" line. Spec D3's acceptance evidence asks for 20/20 failing runs before the fix. This line records a single run and only says FAILED. The failure is deterministic, so one run is enough, but give the count and where it failed so nobody reads FAILED as 1 of 20. For example: "1/1 failed: git commit -m seed exited 128 because the system signing program failed."

I checked these and found nothing to fix:

  • Isolation: gitexec.Command replaces the whole environment, so no system or global config reaches either fixture: not signing, not core.hooksPath, not LFS filters. Inherited GIT_CONFIG_PARAMETERS and GIT_TEMPLATE_DIR are gone too. Only the repo-local identity the tests write is left. I reproduced this by hand on a host whose system config sets commit.gpgsign=true:
    • the pinned git with a Bazel-like env exits 128 at commit;
    • the same commit with this closure's env exits 0, unsigned.
      So dropping --no-gpg-sign is safe.
  • Leftovers and precedent: nothing else in config_test.go runs git, and os/exec is gone. The pattern matches platform/git/repo/repo_test.go:63 and submitqueue/extension/changeprovider/git/provider_test.go:95.
  • Repo rules:
    • no new comments;
    • gofmt is clean;
    • the BUILD change is the single sorted dep gazelle adds;
    • scope is D3's two files;
    • the diff, commit and PR body name no internal systems;
    • the PR body puts the TLDR first and has no Revert Plan or Issue Links sections.
  • Test Plan: it matches the implementer's test logs. The pre-change run fails at git commit -m seed with exit 128. 20/20 runs pass, and 10/10 pass under race.
  • Smaller alternative: -c commit.gpgsign=false on the one commit would be a smaller diff with no BUILD change. But it leaves system hooks and filters in place, and it leaves the Tango test's one-off flag. gitexec is the repo's single source for this environment, so the PR takes the right route.

Out of scope, no action needed: the code under test (newProfiles calling gitrepo.NewRepo with an empty Git) resolves git from PATH. Run locally, it uses the host's git binary, but under gitrepo's own scrubbed config.

…texec

TestNewProfiles_GitChangeProviderReadsARealRepository failed on every run on
hosts whose system git config enables commit signing: `git commit -m seed`
exited 128 with "gpg failed to sign the data". The local `run` closure used
exec.Command with the inherited environment, so system and global git config
(signing, hooks) applied to the test repositories.

Both `run` closures now build their commands with gitexec.Command, which
isolates host git config (system and global) and puts the pinned git first on
PATH, so plain `git <subcommand>` calls use it. It does not pin every git
helper binary: local clone and push still run git-upload-pack and
git-receive-pack by name, and those resolve from host git.

The Tango test only passed because it hard-coded --no-gpg-sign; that flag is
dropped, since removing host config makes it unnecessary and keeping it would
suggest the isolation is not enough.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sbalabanov
sbalabanov force-pushed the sergeyb/test-orchestrator-config-gitexec branch from 93865ef to 40ef5b8 Compare December 3, 2026 21:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant